<?php
/**
 * Created:
 * User: lisgroup
 * Time: 2017/5/21 11:56
 */
namespace lisfw;

class Route {
    //路由地址的解析，映射方法
    public function parse()
    {
        $pathinfo   =   isset($_SERVER['PATH_INFO']) ? explode('/', $_SERVER['PATH_INFO']) : [];
        $appName    =   isset($pathinfo[1]) ? $pathinfo[1] : config('DEFAULT_APP');         //项目名称
        $className =    isset($pathinfo[2]) ? $pathinfo[2] : config('DEFAULT_CONTROLLER');   //控制器名称
        $method     =   isset($pathinfo[3]) ? $pathinfo[3] : config('DEFAULT_METHOD');      //方法
        //控制器
        $controller = $appName . '\controller\\' . $className . 'Controller';
        $class = new $controller;
        $class->$method();
    }
}